{extend name="layout" /}
{block name="content"}
<div class="mui-content">
	<div class="tm-df-size uk-margin-small-top">
		<form id="formid" method="post">
		<ul class="mui-table-view max">
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">用户名</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<input class="tm-font-gray" type="text" name="username" value="{$info.username}" readonly style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
							<div class="tm-icon">
								<img src="{$images_path}xinxin.png" alt="" width="6" height="6"/>
							</div>
						</div>
					</div>
				</div>
			</li>

			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">真实姓名</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<input class="tm-font-gray" type="text" name="realname" value="{$info.realname}" style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
							<div class="tm-icon">
								<img src="{$images_path}xinxin.png" alt="" width="6" height="6"/>
							</div>
						</div>
					</div>
				</div>
			</li>

			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">联系电话</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<input class="tm-font-gray" type="text" name="phone" value="{$info.phone}" style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
							<div class="tm-icon">
								<img src="{$images_path}xinxin.png" alt="" width="6" height="6"/>
							</div>
						</div>
					</div>
				</div>
			</li>
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">邮箱地址</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<input class="tm-font-gray" type="text" id="email" name="email" value="{$info.email}" style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
						</div>
					</div>
				</div>
			</li>
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">职位</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<!-- <input class="tm-font-gray" type="text" name="roleid" value="" style="width: 200px;height: 30px;border: none;text-align: right;"> -->
								<select class="tm-font-gray" name="roleid" style="width: 120px;height: 30px;border: none;padding: 0px 10px;">
									{volist name=":get_model_func('AuthGroup', 'list_data', [])" id="v"}
									<option value="{$v.id}" {eq name="info.roleid" value="$v.id"} selected {/eq}>{$v.title}</option>
									{/volist}
								</select>
							</div>
						</div>
					</div>
				</div>
			</li>
			<li class="mui-table-view-cell">
				<div class="tm-cell-pad">
					<div class="tm-flex flex-align-center">
						<div class="tm-flex-1">
							<span class="tm-font-bold">登录密码</span>
						</div>
						<div class="tm-icon-item">
							<div class="tm-icon-label">
								<input class="tm-font-gray" type="password" name="password" value="" style="width: 200px;height: 30px;border: none;text-align: right;">
							</div>
							<div class="tm-icon">
								<img src="{$images_path}xinxin.png" alt="" width="6" height="6" />
							</div>
						</div>
					</div>
				</div>
			</li>
			<li class="mui-table-view-cell">
				<div>
					<div class="tm-cell-pad">
						<div class="tm-flex flex-align-center">
							<div class="tm-flex-1">
								<span class="tm-font-bold">发送密码到手机</span>
							</div>
							<div>
								<div class="mui-switch mui-switch-mini mui-active" id="switch-phone">
									<div class="mui-switch-handle"></div>
								</div>
								<input type="hidden" value="1" id="switch-phone-input"/>
							</div>
						</div>
					</div>
				</div>
			</li>

			<li class="mui-table-view-cell">
				<div>
					<div class="tm-cell-pad">
						<div class="tm-flex flex-align-center">
							<div class="tm-flex-1">
								<span class="tm-font-bold">发送密码到邮箱</span>
							</div>
							<div>
								<div class="mui-switch mui-switch-mini" id="switch-email">
									<div class="mui-switch-handle"></div>
								</div>
								<input type="hidden" value="0" id="switch-email-input"/>
							</div>
						</div>
					</div>
				</div>
			</li>
		</ul>
		<input type="hidden" name="userid" value="{$info.userid}">
		<div class="uk-margin-large-top uk-text-center">
            <button class="mui-btn mui-btn-green btn-radiu-large pay-btn cocoPostFormAjax" formid="formid" ajaxurl="{:url('v2/adminuser/update_info')}" 
            		type="button" style="width: 90%; height: 45px;" ajax-callback="suc_back">
                保存
            </button>
        </div>
		</form>
	</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
  
</script>
<script type="text/javascript">
	mui(document).on('tap','#switch-phone',function(){
		var flag = this.classList.contains('mui-active') ? '1' : '0';
		var inputDom = document.getElementById("switch-phone-input");
		inputDom.value = flag;
		// console.log(inputDom.value);
	})
	mui(document).on('tap','#switch-email',function(){
		if (!email) {
			coco_msg('邮箱地址为空，不能发邮件通知');
			return false;
		}
		var flag = this.classList.contains('mui-active') ? '1' : '0';
		var email = $("#email").val();
		var inputDom = document.getElementById("switch-email-input");
		inputDom.value = flag;
		// console.log(inputDom.value);
	})
	function suc_back(obj, data) {
   		coco_msg('保存成功');
		setTimeout(function() {
			wx.miniProgram.navigateBack();
		}, 500);
   }
</script>
{/block}